<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>
 <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="js/jquery-1.4.2.min.js" language="JavaScript"></script>

<style>
   ul{ height:80px;}
   li{ margin-top:7px;float:left;width:300px;font-size:40px;overflow:hidden  }  
   radio{width:35px; height:35px;}
</style>
<body>
 <div style="border:2px solid #f0f0f0; height:100px; width:100%">
      
	     <div id="sqname" style="width:100%;  text-align:center ;float:left; font-size:50px;margin-top:10px">签约 </div>	
</div>
<div style="margin-left:40px; margin-top:40px;" >
<img id="imgPhoto" style="position: left; left:top: 100px; right: 10px;border-radius: 100px;border: none;" height="200px"  src="image/doctor/3.jpg"/><span   style="color:blue; font-size:36px"> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;签约成功!</span>
</div>
	   <div  id="doctorname"  style="height:70px;  font-size:40px; margin-top:30px;">  &nbsp;&nbsp;&nbsp;&nbsp;您的签约类型，让医生更好为您服务:</div>
	        
		 <form    id="form"  method="post" action="contractxml.jsp">
		   <ul>
		       <li> <input      type="radio"   value="0" />高血压</li>
		       <li> <input      type="radio"   value="1" />糖尿病</li>
		       <li> <input      type="radio"   value="2" />65岁以上</li>
		   </ul>
		   <ul>
		       <li>     <input     type="radio"    value="3" />孕产妇</li>
		       <li>     <input     type="radio"   value="4" /> 新生儿</li>
		       <li>     <input     type="radio"   value="5" />恶性肿瘤</li>
		   </ul>
		   <ul>
		       <li>     <input type="radio" value="6" />精神异常</li>
		       <li>      <input     type="radio" value="7" />精神病患者</li>
		       <li>      <input      type="radio" value="8" />残疾人</li>
		   </ul>
		     <ul>
		        <li>     <input      type="radio"  value="9" />6岁以下</li>
		        <li>     <input     type="radio"   value="10" /> 健康</li>
		        <li>     <input      type="radio"  value="11" />其他</li>
		   </ul>
		   
</form>
		   <div>
			<div style="float:left; width:45%; margin-left:3%">
			 <button    id="logon" type="button" style="height:100px;  font-size:44px; background-color: #FFFFFF"  class="btn btn-lg btn-success btn-block" onClick="emit()"> <span style="color:#D5D5D5;"> 跳过</span></button>
			 </div>
			<div style="float:left; width:45% ; margin-left:3%">
			 <button    id="logon" type="button" style="height:100px; font-size:44px; "  class="btn btn-lg btn-success btn-block" onClick="emit()">  签约</button>		
			 </div> 
			
</div>
<div style="height:1px; width:100%; border-bottom:1px dashed #000; margin-top:200px;"></div>
<div style="margin-left:2%; margin-top:40px;     font-size:40px; text-align:center" >咨询您的家庭医生</div>
<div   id="tx"  align="center"> <img  id="yszp" style="position: left; left:top: 100px; right: 10px;border-radius: 100px;border: none;" height="200px"  src="image/doctor/3.jpg"/ ></div>
<div   style="font-size:30px;" align="center" id="ysxm"  >dededwedew</div>
</body>
</html>
<script>
Array.prototype.contains = function ( needle ) {
  for (i in this) {
    if (this[i] == needle) return true;
  }
  return false;
}
 var inputs=document.getElementsByTagName("input");
var id='<%=request.getParameter("doctor_id")%>';
var userid='<%=request.getParameter("userid")%>';
var contract_id='<%=request.getParameter("contract_id")%>';
id=id.substr(2,id.length-2);

window.onload=function(){ 
        history.pushState(null, null, document.URL);
        window.addEventListener('popstate', function () {
            history.pushState(null, null, document.URL);
        });
		 $.ajax( {    
           url:'/QueyServlet',
          type:'get',    
           cache:false,  
	        data:{op:'mysign',contraract_id:contract_id},
            dataType:'json',    
            success:function(msg) { 
			
	          if(msg.result=="ok"){
	                 var data=msg.data;
	                 if(data.length==1){
					 var type=data[0].contract_type;
					      if(type!=undefined){
						  var types=type.split(",")
						   for(var i=0;i<inputs.length;i++){
                                if(inputs[i].type=="radio"){
	                             if(types.contains(inputs[i].value))
		                           inputs[i].checked=true
	                             }
						  }
						  }
					       document.getElementById("imgPhoto").src=data[0].doctor_tx;
						   $('#tx').click(function(){
                               location="mkits.jsp?doctor_logname="+data[0].doctor_logname+""; 
                             });
	   	                document.getElementById("yszp").src=data[0].doctor_tx;
						document.getElementById("ysxm").innerHTML=data[0].doctor_name; 
	                 }
		       }
	         } 
       });
    }
function emit(){

   var type="";
   for(var i=0;i<inputs.length;i++){
       if(inputs[i].type=="radio"){
	      if(inputs[i].checked)
		    type=type+inputs[i].value+','
	   }
   
   }
   if(type!="")
      type=type.substr(0,type.length-1);
   $.ajax( {    
            url:'/UserServlet',
            type:'get',    
            cache:false,  
	        data:{type:type,contract_id:contract_id,opt:'signfial'},  
            dataType:'json',    
            success:function(msg) { 
	          if(msg.result=="ok"){
	               
	   	                 location="index1.html"; 
	                
		       }
	         } 
       });
}

</script>